<template>
  <el-breadcrumb separator="/">
    <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
    <el-breadcrumb-item>数据统计</el-breadcrumb-item>
    <el-breadcrumb-item>数据报表</el-breadcrumb-item>
  </el-breadcrumb>
  <!-- 卡片视图 -->
  <el-card>
    <!-- 2.Dom容器 -->
    <div ref="main" style="width: 1000px; height: 450px"></div>
  </el-card>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { getReportDataApi } from '@/api/report'
import * as echarts from 'echarts'
import _ from 'lodash'
import MyEchart from './components/MyEchart.vue'
const main = ref(null)
onMounted(async () => {
  // 接口返回的数据及图表相关的选项
  const data = await getReportDataApi()
  const myChart = echarts.init(main.value)
  // 自己的常规配置项
  const option = {
    title: {
      text: '用户来源'
    },
    tooltip: {},
    legend: {},
    xAxis: {
      boundaryGap: true
    },
    yAxis: {},
    series: []
  }
  // 合并配置项
  const options = _.merge(data, option)
  myChart.setOption(options)
})
</script>

<style lang="scss" scoped></style>